#pragma once

#include <QString>
#include <QVector>
#include <QtAlgorithms>
#include <QGraphicsScene>

#include "Cell.h"

class Map
{
public:
    static const int PixelsPerCell = 6;

    Map(quint16 , const QString& );
    inline quint16 Width() const { return m_width; }
    void Render(QGraphicsScene*) const;
    inline int CellsCount() const { return m_width * m_width; }
    Cell* ItemAt(int i, int j) const { return m_mapData.at(i * m_width + j); }
    QVector<Cell*> MapData() const { return m_mapData; }
    QVector <int> GetList();
    ~Map();
    Cell* ItemAt(int x, int y) { return m_mapData[x*128+y]; }

private:
    QVector <int> m_mapList;
    QVector<Cell*> m_mapData;
    quint16 m_width;
    double m_scaleCoef;

    Cell* m_wallSample;
    Cell* m_bushSample;
    Cell* m_terrainSample;

};

typedef QSharedPointer<Map> MapPtr;

